package genia.service;

import genia.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import genia.entity.User;

/**
 * @description: 实现UserService接口
 * @author: WALKER
 * @date: 2022/4/9 22:18
 */

@Service
public class UserServiceImpl implements UserService {

    //private UserDao userDao = new UserDaoImpl();
    @Autowired
    private UserDao userDao;

    @Override
    public boolean userLogin(User user) {
        User sqlUser = userDao.userLogin(user);

        if(sqlUser == null){
            return false;
        }else{
            if((sqlUser.getUserName().equals(user.getUserName())) && (sqlUser.getPassword().equals( user.getPassword()))) return true;
            return false;
        }

    }

}
